package com.hnqcgczy.ssy.controller;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.hnqcgczy.ssy.dao.IUserDao;
import com.hnqcgczy.ssy.db.MyTransaction;
import com.hnqcgczy.ssy.vo.TUser;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class LoginServlet implements IUserDao{
    private MyTransaction myTransaction;

    public LoginServlet(MyTransaction myTransaction) {
        this.myTransaction = myTransaction;
    }

    @Override
    public boolean getUserByName(String ssy) throws SQLException {
        Connection connection = myTransaction.getConnection();
        String sql="select * from t_user where tu_id=?";
        PreparedStatement ps = connection.prepareStatement(sql);
        ps.setString(1,ssy);
        ResultSet resultSet = ps.executeQuery();
        boolean flag=false;
        while (resultSet.next()){
            flag=true;
        }
        return false;
    }

    @Override
    public boolean insert(TUser user) throws SQLException {
        return false;
    }
}
